home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996…eptember: Technology Seed / Mac Tech Seed Sep '96 / Mac Tech Seed Sep '96.toast / mac / QuickDraw 3D 1.5d7 / Interfaces / QD3DDrawContext.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-23  |  12.8 KB  |  444 lines  |  [TEXT/R*ch]

  1. /******************************************************************************
  2.  **                                                                             **
  3.  **     Module:        QD3DDrawContext.h                                         **
  4.  **                                                                          **
  5.  **                                                                          **
  6.  **     Purpose:    Draw context class types and routines                        **
  7.  **                                                                          **
  8.  **                                                                          **
  9.  **                                                                          **
  10.  **     Copyright (C) 1993-1996 Apple Computer, Inc. All rights reserved.     **
  11.  **                                                                          **
  12.  **                                                                          **
  13.  *****************************************************************************/
  14. #ifndef QD3DDrawContext_h
  15. #define QD3DDrawContext_h
  16.  
  17. #if defined(PRAGMA_ONCE) && PRAGMA_ONCE
  18.     #pragma once
  19. #endif  /*  PRAGMA_ONCE  */
  20.  
  21. #if defined(WINDOW_SYSTEM_MACINTOSH) && WINDOW_SYSTEM_MACINTOSH
  22.  
  23. #if defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  24.     #pragma options enum=small
  25. #endif
  26.     #include <Quickdraw.h>
  27.     #include <FixMath.h>
  28.     #include <GXTypes.h>
  29. #if defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  30.     #pragma options enum=reset
  31. #endif
  32.  
  33. #endif /* WINDOW_SYSTEM_MACINTOSH */
  34.  
  35. #if defined(WINDOW_SYSTEM_X11) && WINDOW_SYSTEM_X11
  36.     #include <X11/Xlib.h>
  37.     #include <X11/Xutil.h>
  38. #endif /* WINDOW_SYSTEM_X11 */
  39.  
  40. #if defined(WINDOW_SYSTEM_WIN32) && WINDOW_SYSTEM_WIN32
  41.     #include <windows.h>
  42.     #include <ddraw.h>
  43. #endif  /*  WINDOW_SYSTEM_WIN32  */
  44.  
  45. #if defined(THINK_C) || defined(__SC__)
  46.     #pragma options(!pack_enums, !align_arrays)
  47.     #pragma SC options align=power
  48. #elif defined(__MWERKS__)
  49.     #pragma enumsalwaysint on
  50.     #pragma align_array_members off
  51.     #pragma options align=native
  52. #elif defined(__PPCC__)
  53.     #pragma options align=power
  54. #elif defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  55.     #pragma options enum=int
  56. #endif
  57.  
  58. #ifdef __cplusplus
  59. extern "C" {
  60. #endif /*  __cplusplus  */
  61.  
  62.  
  63. /******************************************************************************
  64.  **                                                                             **
  65.  **                            DrawContext Data Structures                         **
  66.  **                                                                             **
  67.  *****************************************************************************/
  68.  
  69. typedef enum TQ3DrawContextClearImageMethod{
  70.     kQ3ClearMethodNone,
  71.     kQ3ClearMethodWithColor
  72. } TQ3DrawContextClearImageMethod;
  73.  
  74.  
  75. typedef struct TQ3DrawContextData {
  76.     TQ3DrawContextClearImageMethod    clearImageMethod;
  77.     TQ3ColorARGB                    clearImageColor;
  78.     TQ3Area                            pane;
  79.     TQ3Boolean                        paneState;
  80.     TQ3Bitmap                        mask;
  81.     TQ3Boolean                        maskState;
  82.     TQ3Boolean                        doubleBufferState;
  83. } TQ3DrawContextData;
  84.  
  85.  
  86. /******************************************************************************
  87.  **                                                                             **
  88.  **                                DrawContext Routines                         **
  89.  **                                                                             **
  90.  *****************************************************************************/
  91.  
  92. QD3D_EXPORT TQ3ObjectType Q3DrawContext_GetType(
  93.     TQ3DrawContextObject        drawContext);
  94.  
  95. QD3D_EXPORT TQ3Status Q3DrawContext_SetData(
  96.     TQ3DrawContextObject        context,
  97.     const TQ3DrawContextData    *contextData);
  98.  
  99. QD3D_EXPORT TQ3Status Q3DrawContext_GetData(
  100.     TQ3DrawContextObject        context,
  101.     TQ3DrawContextData            *contextData);
  102.     
  103. QD3D_EXPORT TQ3Status Q3DrawContext_SetClearImageColor(
  104.     TQ3DrawContextObject        context,
  105.     const TQ3ColorARGB             *color);
  106.  
  107. QD3D_EXPORT TQ3Status Q3DrawContext_GetClearImageColor(
  108.     TQ3DrawContextObject        context,
  109.     TQ3ColorARGB                 *color);
  110.  
  111. QD3D_EXPORT TQ3Status Q3DrawContext_SetPane(
  112.     TQ3DrawContextObject        context,
  113.     const TQ3Area                 *pane);
  114.  
  115. QD3D_EXPORT TQ3Status Q3DrawContext_GetPane(
  116.     TQ3DrawContextObject        context,
  117.     TQ3Area                         *pane);
  118.  
  119. QD3D_EXPORT TQ3Status Q3DrawContext_SetPaneState(
  120.     TQ3DrawContextObject        context,
  121.     TQ3Boolean                    state);
  122.  
  123. QD3D_EXPORT TQ3Status Q3DrawContext_GetPaneState(
  124.     TQ3DrawContextObject        context,
  125.     TQ3Boolean                    *state);
  126.         
  127. QD3D_EXPORT TQ3Status Q3DrawContext_SetClearImageMethod(
  128.     TQ3DrawContextObject            context,
  129.     TQ3DrawContextClearImageMethod     method);
  130.         
  131. QD3D_EXPORT TQ3Status Q3DrawContext_GetClearImageMethod(
  132.     TQ3DrawContextObject            context,
  133.     TQ3DrawContextClearImageMethod     *method);
  134.         
  135. QD3D_EXPORT TQ3Status Q3DrawContext_SetMask(
  136.     TQ3DrawContextObject        context,
  137.     const TQ3Bitmap                *mask);
  138.         
  139. QD3D_EXPORT TQ3Status Q3DrawContext_GetMask(
  140.     TQ3DrawContextObject        context,
  141.     TQ3Bitmap                    *mask);
  142.  
  143. QD3D_EXPORT TQ3Status Q3DrawContext_SetMaskState(
  144.     TQ3DrawContextObject        context,
  145.     TQ3Boolean                    state);
  146.  
  147. QD3D_EXPORT TQ3Status Q3DrawContext_GetMaskState(
  148.     TQ3DrawContextObject        context,
  149.     TQ3Boolean                    *state);
  150.  
  151. QD3D_EXPORT TQ3Status Q3DrawContext_SetDoubleBufferState(
  152.     TQ3DrawContextObject        context,
  153.     TQ3Boolean                     state);
  154.  
  155. QD3D_EXPORT TQ3Status Q3DrawContext_GetDoubleBufferState(
  156.     TQ3DrawContextObject        context,
  157.     TQ3Boolean                     *state);
  158.  
  159.  
  160. /******************************************************************************
  161.  **                                                                             **
  162.  **                            Pixmap Data Structure                             **
  163.  **                                                                             **
  164.  *****************************************************************************/
  165.  
  166. typedef struct TQ3PixmapDrawContextData {
  167.     TQ3DrawContextData        drawContextData;
  168.     TQ3Pixmap                pixmap;
  169. } TQ3PixmapDrawContextData;
  170.  
  171.  
  172. /******************************************************************************
  173.  **                                                                             **
  174.  **                        Pixmap DrawContext Routines                             **
  175.  **                                                                             **
  176.  *****************************************************************************/
  177.  
  178. QD3D_EXPORT TQ3DrawContextObject Q3PixmapDrawContext_New(
  179.     const TQ3PixmapDrawContextData    *contextData);
  180.  
  181. QD3D_EXPORT TQ3Status Q3PixmapDrawContext_SetPixmap(
  182.     TQ3DrawContextObject            drawContext,
  183.     const TQ3Pixmap                    *pixmap);
  184.  
  185. QD3D_EXPORT TQ3Status Q3PixmapDrawContext_GetPixmap(
  186.     TQ3DrawContextObject            drawContext,
  187.     TQ3Pixmap                        *pixmap);
  188.  
  189. #if defined(WINDOW_SYSTEM_MACINTOSH) && WINDOW_SYSTEM_MACINTOSH
  190.  
  191. /******************************************************************************
  192.  **                                                                             **
  193.  **                        Macintosh DrawContext Data Structures                 **
  194.  **                                                                             **
  195.  *****************************************************************************/
  196.  
  197. typedef enum TQ3MacDrawContext2DLibrary {
  198.     kQ3Mac2DLibraryNone,
  199.     kQ3Mac2DLibraryQuickDraw,
  200.     kQ3Mac2DLibraryQuickDrawGX
  201. } TQ3MacDrawContext2DLibrary;
  202.  
  203.  
  204. typedef struct TQ3MacDrawContextData {
  205.     TQ3DrawContextData            drawContextData;
  206.     CWindowPtr                    window;
  207.     TQ3MacDrawContext2DLibrary    library;
  208.     gxViewPort                    viewPort;
  209.     CGrafPtr                    grafPort;
  210. } TQ3MacDrawContextData;
  211.  
  212.  
  213. /******************************************************************************
  214.  **                                                                             **
  215.  **                        Macintosh DrawContext Routines                         **
  216.  **                                                                             **
  217.  *****************************************************************************/
  218.  
  219. QD3D_EXPORT TQ3DrawContextObject Q3MacDrawContext_New(
  220.     const TQ3MacDrawContextData    *drawContextData);
  221.     
  222. QD3D_EXPORT TQ3Status Q3MacDrawContext_SetWindow(
  223.     TQ3DrawContextObject        drawContext,
  224.     const CWindowPtr            window);
  225.  
  226. QD3D_EXPORT TQ3Status Q3MacDrawContext_GetWindow(
  227.     TQ3DrawContextObject        drawContext,
  228.     CWindowPtr                    *window);
  229.  
  230. QD3D_EXPORT TQ3Status Q3MacDrawContext_SetGXViewPort(
  231.     TQ3DrawContextObject        drawContext,
  232.     const gxViewPort            viewPort);
  233.  
  234. QD3D_EXPORT TQ3Status Q3MacDrawContext_GetGXViewPort(
  235.     TQ3DrawContextObject        drawContext,
  236.     gxViewPort                    *viewPort);
  237.  
  238. QD3D_EXPORT TQ3Status Q3MacDrawContext_SetGrafPort(
  239.     TQ3DrawContextObject        drawContext,
  240.     const CGrafPtr                grafPort);
  241.  
  242. QD3D_EXPORT TQ3Status Q3MacDrawContext_GetGrafPort(
  243.     TQ3DrawContextObject        drawContext,
  244.     CGrafPtr                    *grafPort);
  245.  
  246. QD3D_EXPORT TQ3Status Q3MacDrawContext_Set2DLibrary(
  247.     TQ3DrawContextObject        drawContext,
  248.     TQ3MacDrawContext2DLibrary    library);
  249.  
  250. QD3D_EXPORT TQ3Status Q3MacDrawContext_Get2DLibrary(
  251.     TQ3DrawContextObject        drawContext,
  252.     TQ3MacDrawContext2DLibrary    *library);
  253.  
  254. #endif /* WINDOW_SYSTEM_MACINTOSH */
  255.  
  256. #if defined(WINDOW_SYSTEM_X11) && WINDOW_SYSTEM_X11
  257.  
  258. /******************************************************************************
  259.  **                                                                             **
  260.  **                                Types                                         **
  261.  **                                                                             **
  262.  *****************************************************************************/
  263.  
  264. typedef struct TQ3XBufferData *TQ3XBufferObject;
  265.  
  266. typedef struct TQ3XColormapData {
  267.     long        baseEntry;
  268.     long        maxRed;
  269.     long        maxGreen;
  270.     long        maxBlue;
  271.     long        multRed;
  272.     long        multGreen;
  273.     long        multBlue;
  274. } TQ3XColormapData;
  275.  
  276.  
  277. typedef struct TQ3XDrawContextData {
  278.     TQ3DrawContextData        contextData;
  279.     Display                    *display;
  280.     Drawable                drawable;
  281.     Visual                    *visual;
  282.     Colormap                cmap;
  283.     TQ3XColormapData        *colorMapData;
  284. } TQ3XDrawContextData;
  285.  
  286.  
  287. /******************************************************************************
  288.  **                                                                             **
  289.  **                            XDrawContext Routines                             **
  290.  **                                                                             **
  291.  *****************************************************************************/
  292.  
  293. #ifdef XDC_OLD
  294. QD3D_EXPORT TQ3DrawContextObject Q3XDrawContext_New(
  295.     void);
  296.  
  297. QD3D_EXPORT void Q3XDrawContext_Set(
  298.     TQ3DrawContextObject    drawContext,
  299.     unsigned long            flag,                             
  300.     void                    *data);
  301.  
  302. QD3D_EXPORT void Q3XDrawContext_Get(
  303.     TQ3DrawContextObject    drawContext,
  304.     unsigned long            flag,                             
  305.     void                    *data);
  306. #endif  /* XDC_OLD */
  307.  
  308. QD3D_EXPORT TQ3XBufferObject Q3XBuffers_New(
  309.     Display                    *dpy,                       
  310.     unsigned long            numBuffers,
  311.     Window                    window);
  312.  
  313. QD3D_EXPORT void Q3XBuffers_Swap(
  314.     Display                    *dpy,
  315.     TQ3XBufferObject        buffers);
  316.  
  317. QD3D_EXPORT XVisualInfo *Q3X_GetVisualInfo(
  318.     Display                    *dpy,
  319.     Screen                    *screen);
  320.  
  321.  
  322. QD3D_EXPORT TQ3DrawContextObject Q3XDrawContext_New(
  323.     const TQ3XDrawContextData    *xContextData);
  324.  
  325. QD3D_EXPORT TQ3Status Q3XDrawContext_SetDisplay(
  326.     TQ3DrawContextObject        drawContext,
  327.     const Display                *display);
  328.  
  329. QD3D_EXPORT TQ3Status Q3XDrawContext_GetDisplay(
  330.     TQ3DrawContextObject        drawContext,
  331.     Display                        **display);
  332.  
  333. QD3D_EXPORT TQ3Status Q3XDrawContext_SetDrawable(
  334.     TQ3DrawContextObject        drawContext,
  335.     Drawable                    drawable);
  336.  
  337. QD3D_EXPORT TQ3Status Q3XDrawContext_GetDrawable(
  338.     TQ3DrawContextObject        drawContext,
  339.     Drawable                    *drawable);
  340.  
  341. QD3D_EXPORT TQ3Status Q3XDrawContext_SetVisual(
  342.     TQ3DrawContextObject        drawContext,
  343.     const Visual                *visual);
  344.  
  345. QD3D_EXPORT TQ3Status Q3XDrawContext_GetVisual(
  346.     TQ3DrawContextObject        drawContext,
  347.     Visual                        **visual);
  348.  
  349. QD3D_EXPORT TQ3Status Q3XDrawContext_SetColormap(
  350.     TQ3DrawContextObject        drawContext,
  351.     Colormap                    colormap);
  352.  
  353. QD3D_EXPORT TQ3Status Q3XDrawContext_GetColormap(
  354.     TQ3DrawContextObject        drawContext,
  355.     Colormap                    *colormap);
  356.  
  357. QD3D_EXPORT TQ3Status Q3XDrawContext_SetColormapData(
  358.     TQ3DrawContextObject        drawContext,
  359.     const TQ3XColormapData        *colormapData);
  360.  
  361. QD3D_EXPORT TQ3Status Q3XDrawContext_GetColormapData(
  362.     TQ3DrawContextObject        drawContext,
  363.     TQ3XColormapData            *colormapData);
  364.  
  365. #endif /* WINDOW_SYSTEM_X11 */
  366.  
  367. #if defined(WINDOW_SYSTEM_WIN32) && WINDOW_SYSTEM_WIN32
  368.  
  369. /******************************************************************************
  370.  **                                                                             **
  371.  **                                Types                                         **
  372.  **                                                                             **
  373.  *****************************************************************************/
  374.  
  375. typedef struct TQ3Win32DCDrawContextData {
  376.     TQ3DrawContextData        drawContextData;
  377.     HDC                        hdc;
  378. } TQ3Win32DCDrawContextData;
  379.  
  380. typedef struct TQ3DDSurfaceDrawContextData {
  381.     TQ3DrawContextData        drawContextData;
  382.     LPDIRECTDRAW            lpDirectDraw;
  383.     LPDIRECTDRAWSURFACE        lpDirectDrawSurface;
  384. } TQ3DDSurfaceDrawContextData;
  385.  
  386.  
  387. /******************************************************************************
  388.  **                                                                             **
  389.  **                            Win32DC DrawContext Routines                     **
  390.  **                                                                             **
  391.  *****************************************************************************/
  392.  
  393. QD3D_EXPORT TQ3DrawContextObject Q3Win32DCDrawContext_New(
  394.     const TQ3Win32DCDrawContextData    *drawContextData);
  395.  
  396. QD3D_EXPORT TQ3Status Q3Win32DCDrawContext_SetDC(
  397.     TQ3DrawContextObject        drawContext,
  398.     const HDC                    hdc);
  399.  
  400. QD3D_EXPORT TQ3Status Q3Win32DCDrawContext_GetDC(
  401.     TQ3DrawContextObject        drawContext,
  402.     HDC                            *hdc);
  403.  
  404.  
  405. /******************************************************************************
  406.  **                                                                             **
  407.  **                            DDSurface DrawContext Routines                     **
  408.  **                                                                             **
  409.  *****************************************************************************/
  410.  
  411. QD3D_EXPORT TQ3DrawContextObject Q3DDSurfaceDrawContext_New(
  412.     const TQ3DDSurfaceDrawContextData    *drawContextData);
  413.  
  414. QD3D_EXPORT TQ3Status Q3DDSurfaceDrawContext_SetDirectDraw(
  415.     TQ3DrawContextObject        drawContext,
  416.     const LPDIRECTDRAW            lpDirectDraw);
  417.  
  418. QD3D_EXPORT TQ3Status Q3DDSurfaceDrawContext_GetDirectDraw(
  419.     TQ3DrawContextObject        drawContext,
  420.     LPDIRECTDRAW                *lpDirectDraw);
  421.  
  422. QD3D_EXPORT TQ3Status Q3DDSurfaceDrawContext_SetDirectDrawSurface(
  423.     TQ3DrawContextObject        drawContext,
  424.     const LPDIRECTDRAWSURFACE    lpDirectDrawSurface);
  425.  
  426. QD3D_EXPORT TQ3Status Q3DDSurfaceDrawContext_GetDirectDrawSurface(
  427.     TQ3DrawContextObject        drawContext,
  428.     LPDIRECTDRAWSURFACE            *lpDirectDrawSurface);
  429.  
  430. #endif  /*  WINDOW_SYSTEM_WIN32  */
  431.  
  432.  
  433. #ifdef __cplusplus
  434. }
  435. #endif /*  __cplusplus  */
  436.  
  437. #if defined(__MWERKS__)
  438.     #pragma enumsalwaysint reset
  439. #elif defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  440.     #pragma options enum=reset
  441. #endif
  442.  
  443. #endif  /*  QD3DDrawContext_h  */
  444.